<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<link href="<%=request.getContextPath()%>/static/common/plugin/Uimaker/css/style.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" href="<%=request.getContextPath() %>/static/common/plugin/bootstrap-3.3.5/css/bootstrap.min.css">
</head>
<body>
<c:if test="${empty pagemodel }">
<script>
	setTimeout(function() {
		location = '<%=request.getContextPath()%>/PositionServlet?command=lists';
	}, 0);
</script>			
</c:if>
<c:if test="${!empty pagemodel }">
<div class="place">
    <span>位置：</span>
    <ul class="placeul">
    <li><a href="#">职位查询</a></li>
    </ul>
    </div>
<table class="table">
	<caption>
		<strong>一、职位信息：</strong>
			
	</caption>
	<tr >
	<td colspan="4">
	<form id="fromurl" action="<%=request.getContextPath()%>/PositionServlet?command=lists" method="post">
	薪资：<input type="text" name="salary" value="${position.salary }"/>
	<input type="submit" value="查询"/>
	
	</form>
	</td>
	
	</tr>
	
	
	
	
	<thead>
	<tr>
    <th ><center>编号</center></th>
    <th ><center>职位名称</center></th>
    <th ><center>薪资范围</center></th>
    <th ><center>发布时间</center></th>
    </tr>
	</thead>
	<tbody>
		<c:forEach items="${pagemodel.list }" var="position" varStatus="v">
 <tr>
 <td><center>${position.id }</center></td>
 <td><center>${position.name }</center></td>
 <td><center>${position.salary1 }~${position.salary2 }</center></td>
 <td><center><fmt:formatDate value="${position.releaseTime }" pattern="yyyy-MM-dd HH:mm:ss"/></center></td>
  </tr>
</c:forEach>
	</tbody>
	<tr>
<td colspan="4" align="right">

<a href="javascript:subform('<%=request.getContextPath()%>/PositionServlet?command=lists&pageNo=${pagemodel.first}')">首页</a>&nbsp;
<a href="javascript:subform('<%=request.getContextPath()%>/PositionServlet?command=lists&pageNo=${pagemodel.pre}')">上一页</a>&nbsp;
<a href="javascript:subform('<%=request.getContextPath()%>/PositionServlet?command=lists&pageNo=${pagemodel.next}')">下一页</a>&nbsp;
<a href="javascript:subform('<%=request.getContextPath()%>/PositionServlet?command=lists&pageNo=${pagemodel.last}')">尾页</a>&nbsp;
<select onchange="page(this)">
<script>

var page='${pagemodel.pageNo}';
var intalpage='${pagemodel.totalpage}';
console.info(page);
console.info(intalpage);
for(var i=1;i<=intalpage;i++){
	if(i==page){
	document.write('<option value="'+i+'" selected="selected">'+i+'</option>');	
	}
	else{
		document.write('<option value="'+i+'">'+i+'</option>');	
	}
}
</script>
</select>

共${pagemodel.totalpage }页&nbsp;
共${pagemodel.allRecords }条记录
</table>
<script>
function page(object){
	subform('<%=request.getContextPath()%>/PositionServlet?command=lists&pageNo='+object.value);
	
}
function subform(url){
	var formurl=document.getElementById("fromurl");
	formurl.action=url;
	formurl.submit();
}



</script>
</c:if>

</body>


</html>